<template>
    <f7-page no-toolbar no-tabbar @page:init="initFarmerAuth()">
        <f7-navbar title="认证农民" back-link="返回"></f7-navbar>
        <div>
            <img src="../../../static/img/user.jpg" width="30%" style="padding-left: 35%;padding-top:30px;display:block;text-align: center"/>
        </div>
        <div class="list-block">
            <ul>
                <li>
                    <div class="item-content">
                        <div class="item-media"><i class="icon icon-form-name"></i></div>
                        <div class="item-inner">
                            <div class="item-title label">姓名</div>
                            <div class="item-input">
                                {{farmerMsg.Name}}
                            </div>
                        </div>
                    </div>
                </li>
                <li>
                    <div class="item-content">
                        <div class="item-media"><i class="icon icon-form-name"></i></div>
                        <div class="item-inner">
                            <div class="item-title label">身份证号</div>
                            <div class="item-input">
                                {{farmerMsg.IdCard}}
                            </div>
                        </div>
                    </div>
                </li>
                <li>
                    <div class="item-content">
                        <div class="item-media"><i class="icon icon-form-name"></i></div>
                        <div class="item-inner">
                            <div class="item-title label">手机号</div>
                            <div class="item-input">
                                {{farmerMsg.Phoneno}}
                            </div>
                        </div>
                    </div>
                </li>
            </ul>
        </div>
        <div class="content-block">
            <div class="upload-box">
                {{farmerMsg.IdCardPositive}}
            </div>
            <div class="upload-box">
                {{farmerMsg.IdCardNegative}}
            </div>
        </div>
        <div style="margin-bottom: 30px;">
            <div class="row" style="padding: 0 15px;">
                <div class="col-50"><a href="#" data-force="true" class="back button button-big button-fill color-gray" @click="refusePassThroughVerigy()">不通过</a></div>
                <div class="col-50"><a href="#" data-force="true" class="back button button-big button-fill color-green confirm-ok" @click="passThroughVerigy()">通过</a></div>
            </div>
        </div>
    </f7-page>
</template>

<style>
    .upload-box {
        height: 200px;
        line-height:180px;
        color: gray;
        border: dashed 2px gray;
        text-align:center;
        margin-bottom:20px;
        background-color:white;
    }
</style>
<script>
    import data from '../../../src/data/index'
    export default{
        data(){
            return{
                farmerMsg:''
            }
        },
        methods:{
            initFarmerAuth(){
                console.log(this.$route.params.Id);
                let that = this;
                data.gover.getFarmerMsg(this.$route.params.Id,function (data) {
                    that.farmerMsg = data;
                })
            },
            passThroughVerigy(){
                let that = this;
                let alertContent = '你确认通过<span style="color: red">'+ this.farmerMsg.Name + '</span>认证吗?';
                this.$f7.confirm(alertContent,'麦子提示您',
                    function () {
                        data.gover.agreeFarmerAuth(that.$route.params.Id,function () {
                            that.$f7.alert("认证成功",'麦子提示您',function () {
                                that.$router.back();
                            })
                        })
                    })
            },
            refusePassThroughVerigy(){
                let that = this;
                let alertContent = '你确认拒绝<span style="color: red">'+ this.farmerMsg.Name + '</span>认证吗?';
                this.$f7.confirm(alertContent,'麦子提示您',
                    function () {
                        data.gover.refuseFarmerAuth(that.$route.params.Id,function () {
                            that.$f7.alert("拒绝认证成功",'麦子提示您',function () {
                                that.$router.back();
                            })
                        })
                    })
            }
        }
    }
</script>